package OOP.HouseRent;

import java.util.Scanner;

public class HouseMenu {
    public static void housemenu() {
        Scanner scanner = new Scanner(System.in);
        boolean iscontinue = true;
        Houses house[] = new Houses[0];
        int count = 1;
        while(iscontinue){
            System.out.println("----------房屋出租系统----------");
            System.out.println("\t\t1. 新增房源");
            System.out.println("\t\t2. 查找房源");
            System.out.println("\t\t3. 删除房源");
            System.out.println("\t\t4. 修改房屋信息");
            System.out.println("\t\t5. 房屋列表");
            System.out.println("\t\t6. 退    出");
            System.out.print("请输入：");

            int choice = scanner.nextInt();
            switch(choice){
                case 1:
                    house = HouseService.AddHouse(house,count++);
                    break;
                case 2:
                    HouseService.FindHouse(house);
                    break;
                case 3:
                    house = HouseService.RemoveHouse(house);
                    break;
                case 4:
                    house = HouseService.reviseHouse(house);
                    break;
                case 5:
                    HouseService.showhouses(house);
                    break;
                case 6:
                    while(true){
                        System.out.println("你确定要退出吗？  Y/N");
                        char choice2 = scanner.next().charAt(0);
                        if(choice2 == 'Y'){
                            iscontinue = false;
                            System.out.println("退出成功");
                            break;
                        }
                        else break;
                    }

            }
        }


    }

}
